import java.util.Hashtable;

public final class ay
{

    private cc b;
    public boolean a;
    private i c;

    public ay(i j)
    {
        b = new cc();
        c = j;
    }

    public final void a(q q1)
    {
        a = false;
        b.b();
        int j = 0;
        for(int k = q1.b(); j < k; j++)
            b(q1.a(j));

    }

    private void b(q q1)
    {
        bf bf1 = new bf(q1);
        a(bf1);
        a = a || bf1.c();
    }

    private void a(bf bf1)
    {
        b.e(bf1);
    }

    public final int a()
    {
        return b.a;
    }

    public final bf a(int j)
    {
        return (bf)b.a(j);
    }

    public final bf a(String s)
    {
        cc cc1 = b;
        int j = 0;
        for(int k = cc1.a; j < k; j++)
        {
            bf bf1;
            if((bf1 = (bf)cc1.a(j)).a().equals(s))
                return bf1;
        }

        return null;
    }

    public final q a(String s, q q1)
    {
        bf bf1;
        if((bf1 = a(s)) != null)
            return bf1.g();
        else
            return q1;
    }

    private String c(String s)
    {
        return a(s, q.c).toString();
    }

    public final boolean b(String s, q q1)
    {
        bf bf1;
        if((bf1 = a(s)) != null)
        {
            bf1.a(q1);
            return true;
        } else
        {
            return false;
        }
    }

    public final q b()
    {
        int j;
        q aq[] = new q[j = a()];
        for(int k = 0; k < j; k++)
            aq[k] = a(k).a;

        return q.a(aq);
    }

    public final Hashtable c()
    {
        Hashtable hashtable = new Hashtable();
        int j = 0;
        for(int k = a(); j < k; j++)
        {
            bf bf1 = a(j);
            hashtable.put(bf1.a(), bf1.g());
        }

        return hashtable;
    }

    public final q d()
    {
        q q1 = q.h();
        int j = 0;
        for(int k = a(); j < k; j++)
        {
            bf bf1;
            if(!(bf1 = a(j)).c)
                continue;
            bf1.c = false;
            q q2;
            if((q2 = bf1.g()).c())
                q1.c(q.b(q.c(bf1.a()), q2));
        }

        if(q1.b() > 0)
            return q1;
        else
            return null;
    }

    public final void e()
    {
        int j = 0;
        for(int k = a(); j < k; j++)
            if(a(j).c)
            {
                c.a(null, -13);
                return;
            }

    }

    private String d(String s)
    {
        bf bf1;
        if(s.endsWith(".option.name"))
        {
            if((bf1 = a(s.substring(0, s.length() - ".option.name".length()))) != null)
                return bf1.f().toString();
            else
                return null;
        } else
        {
            return c(s);
        }
    }

    public final String b(String s)
    {
        StringBuffer stringbuffer = null;
        int j = 0;
        int l;
        do
        {
            int k = s.indexOf("${", j);
            l = s.indexOf("}", j);
            if ((k) > -1 && (l) > -1) {
                if (stringbuffer == null)
                    stringbuffer = new StringBuffer();
                stringbuffer.append(s.substring(j, k));
                stringbuffer.append(d(s.substring(k + 2, l)));
            }else{
                break;
            }
            j = l + 1;
        } while(true);
        if(stringbuffer == null)
        {
            return s;
        } else
        {
            stringbuffer.append(s.substring(j));
            return stringbuffer.toString();
        }
    }
}